home *** CD-ROM | disk | FTP | other *** search
/ Creative Computers / Creative Computers CD-ROM, Volume 1 (Legendary Design Technologies, Inc.)(1994).iso / shareware / intuition / yak_1.57 / source / clickdrive.c < prev    next >
C/C++ Source or Header  |  1994-11-17  |  991b  |  52 lines

  1. #include <exec/types.h>
  2. #include <devices/trackdisk.h>
  3. #include <proto/exec.h>
  4. #include "yak.h"
  5.  
  6.  
  7. /*
  8.  * Set drive click off if toggle is TRUE
  9.  * Set drive click on otherwise
  10.  *
  11.  */
  12. void __regargs
  13. SetClickDrive (UBYTE toggle)
  14. {
  15.    struct IOExtTD *td;
  16.    struct MsgPort *po;
  17.    struct TDU_PublicUnit *tpu;
  18.    long unit;
  19.  
  20.    if (po = CreatePort (NULL, 0))
  21.    {
  22.       for (unit = 0; unit < 4; unit++)
  23.       {
  24.           if (td = (struct IOExtTD *) CreateExtIO (po, sizeof (struct IOExtTD)))
  25.           {
  26.               if (!(OpenDevice ("trackdisk.device", unit, (struct IORequest *) td, 0L)))
  27.               {
  28.                   tpu = (struct TDU_PublicUnit *) td->iotd_Req.io_Unit;
  29.                   if (toggle==TRUE)     
  30.                   {   
  31.                       /* Stop clicking ! */
  32.                       tpu->tdu_PubFlags |= TDPF_NOCLICK;
  33.                   }
  34.                   else
  35.                   {
  36.                       /* Keep on clicking ! */
  37.                       tpu->tdu_PubFlags &= ~TDPF_NOCLICK;
  38.                   }
  39.                   CloseDevice ((struct IORequest *) td);
  40.                   DeleteExtIO ((struct IORequest *) td);
  41.               }
  42.           }
  43.       }
  44.       DeletePort (po);
  45.    }
  46. }
  47.  
  48.  
  49.  
  50.  
  51.  
  52.